﻿using _1142063_1142080_1142098.Models.DTO;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace _1142063_1142080_1142098.Models.Services
{
    public class NoiDenService
    {
        public static List<NoiDen> LayDanhSach(byte isTrongNuoc)
        {
            var noiDenList = new List<NoiDen>();
            var myDataProvider = new MyDataProvider();
            myDataProvider.Open();
            var parameterList = new List<SqlParameter>();
            parameterList.Add(new SqlParameter("@IstrongNuoc", SqlDbType.TinyInt));
            parameterList[parameterList.Count - 1].Value = isTrongNuoc;
            noiDenList = Utility.ToList<NoiDen>(myDataProvider.ExcuteQueryWithParameters("spu_noiDen_layDanhSachTheoIsTrongNuoc", parameterList));
            noiDenList.Insert(0, new NoiDen() { Id=DateTime.Now,IsTrongNuoc=isTrongNuoc,TenNoiDen="--- Tất cả ---"});
            myDataProvider.Close();
            return noiDenList;
        }
    }
}